package com.globalwave.common.service;

import com.globalwave.base.BaseServiceImpl;
import com.globalwave.common.ArrayOrderList;
import com.globalwave.common.ArrayPageList;
import com.globalwave.common.entity.SyncConfig;
import com.globalwave.common.entity.SyncConfigCriterion;

public class SyncConfigServiceImpl 
       extends BaseServiceImpl 
       implements SyncConfigService {

	private SyncColumnsService syncColumnsService ;
	
    public SyncConfig create(SyncConfig syncConfig) throws Exception {
        return (SyncConfig) jdbcDao.insert(syncConfig);
    }

    public void update(SyncConfig syncConfig) throws Exception {
        jdbcDao.update(syncConfig) ;
    }

    public void delete(SyncConfig syncConfig) throws Exception {
        // delete cascade 
        //OrganizationSyncConfig orgSyncConfig = new OrganizationSyncConfig() ;
        //orgSyncConfig.setSyncConfig_id(syncConfig.getSyncConfig_id()) ;
        //jdbcDao.delete(OrganizationSyncConfig.class, orgSyncConfig) ;
        
        jdbcDao.delete(syncConfig) ;
        
    }

    public void deleteAll(Long[] ids) throws Exception {
        SyncConfigCriterion criterion = new SyncConfigCriterion() ;
        criterion.setIds(ids) ;
        jdbcDao.delete(SyncConfig.class, criterion) ;
        
    }

    public ArrayPageList<SyncConfig> query(
            SyncConfigCriterion criterion, 
            int pageIndex, 
            int pageSize, 
            ArrayOrderList orderList) throws Exception {
        
        if (orderList == null) {
            orderList = new ArrayOrderList() ;
            //orderList.addAsc("syncConfig_id") ;
        }
        
        return (ArrayPageList<SyncConfig>)jdbcDao.query(criterion, pageIndex, pageSize, orderList, SyncConfig.class);
    }

	public void setSyncColumnsService(SyncColumnsService syncColumnsService) {
		this.syncColumnsService = syncColumnsService;
	}


}
